<template>
    <div class="main_box" style="padding:10px">
        <div class="add_wrap">
            <el-form label-width="200px">
                <div class="tit">
                    <h2>基础信息</h2>
                    <el-button type="success" plain size="small" icon="fa fa-mail-forward" @click="returnList">返回
                    </el-button>
                </div>
                <el-row>
                    <el-form-item label="商户号名称:">
                        <span>{{ dataInfo.mchName }}</span>
                    </el-form-item>
                    <el-form-item label="商户号ID:">
                        <span>{{ dataInfo.mchId }}</span>
                    </el-form-item>
                    <el-form-item label="API密钥:">
                        <span>{{ dataInfo.mchPrivateKey }}</span>
                    </el-form-item>
                    <el-form-item label="公司:">
                        <span>{{ dataInfo.company }}</span>
                    </el-form-item>
                    <el-form-item label="医检机构:">
                        <span>{{ dataInfo.institutionId }}</span>
                    </el-form-item>
                    <el-form-item label="状态:">
                        <span>{{ formatState(dataInfo.state) }}</span>
                    </el-form-item>
                    <el-form-item label="备注">
                        <span>{{ dataInfo.remark }}</span>
                    </el-form-item>
                    <el-form-item label="创建人:">
                        <span>{{ dataInfo.createUserName }}</span>
                    </el-form-item>
                    <el-form-item label="创建时间:">
                        <span>{{ dataInfo.createDate }}</span>
                    </el-form-item>
                    <el-form-item label="修改人:">
                        <span>{{ dataInfo.modifyUserName }}</span>
                    </el-form-item>
                    <el-form-item label="修改时间:">
                        <span>{{ dataInfo.modifyDate }}</span>
                    </el-form-item>
                    <el-form-item label="备注:">
                        <span>{{ dataInfo.remark }}</span>
                    </el-form-item>
                </el-row>
            </el-form>
        </div>
    </div>
</template>

<script>
import MerchantNoApi from "@/api/finance/merchantNo"
import InstitutionApi from "@/api/institution/institution";
export default {
    data() {
        return {
            dataInfo: {},
        };
    },
    computed: {
    },
    mounted() {
        this.getData()
    },
    methods: {
        getData() {
            MerchantNoApi.getMerchantNoInfo({ id: this.$route.id })
                .then(res => {
                    this.dataInfo = res.data
                })
        },
        formatState(cellValue) {
            if (cellValue == -1) {
                return "删除";
            } else if (cellValue == 0) {
                return "禁用";
            } else if (cellValue == 1) {
                return "启用";
            }
        },
        listInstitution() {
            let _this = this;
            InstitutionApi.selectInsByUser()
                .then(res => {
                    _this.institutionList = res.data.map(item => {
                        return {
                            value: item.institutionId,
                            label: item.institutionName
                        };
                    });
                })
                .catch(error => {
                    _this.institutionList = [];
                    console.error(error);
                });
        },
        returnList() {
            this.$store.dispatch('delView', this.$route);
            this.$router.push({ path: '/finance/merchantNoManagement' })
        }
    },

}

</script>
<style lang="scss" src="@/assets/css/views/add.scss" scope>

</style>
